package com.navinfo.opentsp.platform.computing.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.googlecode.protobuf.format.JsonFormat;
import com.navinfo.opentsp.platform.location.protocol.common.LCLocationData;
import com.navinfo.opentsp.platform.location.protocol.common.LCTheSixEmissionsData;

import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
        LCTheSixEmissionsData.TheSixEmissionsData theSixEmissionsData = LCTheSixEmissionsData.TheSixEmissionsData.newBuilder().setGpsTime(1).setTerminalId(1).build();
        System.out.println(theSixEmissionsData.hasCheckCode());
        String str = JsonFormat.printToString(theSixEmissionsData);
        System.out.println(str);
        String s = "{\"alarm\": 0,\"status\": 786433,\"longitude\": 0,\"latitude\": 0,\"originalLng\": 0,\"originalLat\": 0,\"height\": 0,\"speed\": 0,\"direction\": 0,\"gpsDate\": 1577700802,\"mileage\": 20900,\"receiveDate\": 1577700804,\"isPatch\": false,\"starStatus\": 0,\"starNumber\": 1,\"statusAddition\": {\"status\": [{\"types\": \"lampState\",\"statusValue\": 0},{\"types\": \"mileage\",\"statusValue\": 0},{\"types\": \"mileageDD\",\"statusValue\": 0},{\"types\": \"differentialMileage\",\"statusValue\": 3916},{\"types\": \"integralFuelConsumption\",\"statusValue\": 187}]},\"additionAlarm\": \"\\u0000@\\u0000\\u0000@\\u0000\\u0000\\uffe0\",\"analysisData\": {\"vehicleSpeedFromEcu\": 0,\"velocityChangeValue\": 0,\"currentRPM\": 0,\"brakeTimes\": 0,\"clutchTimes\": 0,\"absTimes\": 0},\"batteryPower\": 0,\"electricVehicle\": 0,\"standardMileage\": 20.9,\"standardFuelCon\": 1.87,\"terminalId\": 14710512309,\"serialNumber\": 1227,\"part_time\": \"20191230\",\"hashtid\": 21}";
//        System.out.println(s.replace("\"additionAlarm\": \"*\"", "\"additionAlarm\": \"eeeeeeeeeeeeeeeeee\""));
//        System.out.println(s.replaceAll("\\\\u", "").replace("\"additionAlarm\": \".*?\"", "555555555555555"));
        JSONObject jsonObject = JSON.parseObject(s);
        byte[] arr = new byte[]{1,33,5,6,7};

        jsonObject.put("additionAlarm", Arrays.toString(arr));
        System.out.println(jsonObject.getString("additionAlarm"));

    }
}
